<template>
  <div class="myTable">
    <table>
      <thead>
        <th v-if="$store.state.checkHead.length">内存</th>
        <th v-if="$store.state.checkColor.length">颜色</th>
      </thead>
      <tbody>
        <tr v-for="(item, index) in list" :key="index">
          <td>{{ item.name }}</td>
          <td>{{ item.value }}</td>
        </tr>
      </tbody>
    </table>
  </div>
</template>
<script>
import { reactive, toRefs, computed } from "vue";
import { useStore } from "vuex";
export default {
  setup() {
    const store = useStore();
    const jisuan = () => { // 计算属性里面不能写，函数逻辑，可以调用函数
     return store.state.allList.sort((a, b) => parseInt(a.name) - parseInt(b.name));
    }
    const data = reactive({
      list: computed(() => jisuan()),
    });
    return {
      ...toRefs(data),
    };
  },
};
</script>